<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>开启BFC解决margin塌陷问题</title>
  <style>
    *{
      margin: 0;
      padding: 0;
    }

    .outer{
      width: 400px;
      background-color: gray;

      /*display: table;*/
      /*float: left;*/
      /*position: absolute;*/
      /*position: fixed;*/
      /*overflow: hidden;*/
      /*display: inline-block;*/
      /*column-count: 1;*/
      /*display: flow-root;*/
      border: 1px solid black;/*也能解决marin塌陷,但是不能开启BFC*/

    }

    .inner1{
      width: 100px;
      height: 100px;
      background-color: red;
      margin: 10px;
    }

    .inner2{
      width: 100px;
      height: 100px;
      background-color: orange;
      margin-left: 10px;
    }
    .inner3{
      width: 100px;
      height: 100px;
      background-color: green;
      margin: 10px;
    }
  </style>
</head>
<body>

<div class="outer">
  <div class="inner1">1</div>
  <div class="inner2">2</div>
  <div class="inner3">3</div>
</div>
</body>
</html>